﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace WarOfDev.Core.StateManagentHelpers
{
    public class SecurityTokenHelper<TUser> where TUser : class
    {
        private const string securityToken = "_securityToken";

        public static TUser GetSecurityToken(HttpContextBase context)
        {
            return context.Session[securityToken] as TUser;
        }

        public static void SetSecurityToken(HttpContextBase context, TUser user)
        {
            context.Session[securityToken] = user;
        }

        public static void ClearSecurityToken(HttpContextBase context)
        {
            context.Session.Remove(securityToken);
        }
    }
}
